package com.woniu.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.dao.LogDao;
import com.woniu.entity.WebLog;
import com.woniu.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogDao logDao;
    @Override
    public void addLog(WebLog log) {
        logDao.addLog(log);
    }

    @Override
    public PageInfo<WebLog> selectAll(String action, Date startTime, Date endTime, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<WebLog> webLogs = logDao.selectAll(action, startTime, endTime);
        return new PageInfo<>(webLogs);
    }
}
